//
//  EYInstanceVariable.m
//  metadata
//
//  Created by easy on 11-5-27.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "EYInstanceVariable.h"


@implementation EYInstanceVariable
@synthesize ownIvar = own;
@synthesize offset;

-(id) initWith:(Ivar) ivar{
	if (self = [super init]) {
		own = ivar;
	}
	return self;
}
+(id) init:(Ivar) ivar{
	return [[[EYInstanceVariable alloc] initWith:ivar] autorelease];
}
#pragma mark -
#pragma mark setter/getter 
-(NSString *) name{
	return [NSString stringWithCString:ivar_getName(self.ownIvar) encoding:DEFAULT_ENCODING];
}
-(long int) offset{
	ptrdiff_t ptr = ivar_getOffset(self.ownIvar);
	return ptr;
}
-(NSString *) typeEncoding{
	return [NSString stringWithCString:ivar_getTypeEncoding(self.ownIvar) encoding:DEFAULT_ENCODING];
}

-(void) dealloc{
	own = nil;
	[super dealloc];
}
@end
